home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1997 September
/
Macworld (1997-09).dmg
/
Serious Software
/
Cherwell Scientific Demos
/
pro Fit
/
pro Fit 5.0 demo (fpu).sea
/
pro Fit 5.0 demo (fpu)
/
Functions & Programs
/
•Gadgets
/
drawing macros
/
oval
< prev
next >
Wrap
Text File
|
1996-06-01
|
1KB
|
57 lines
{
This program draws an oval shape at the last clicked point in the drawing
window. The oval shape is drawn using a smooth polygon.
The dimensions and orientation of the oval are set in the procedure
Initialize, below.
To use the program, hit cmd-L (or click the Add button), look at its
keyboard equivalent in the Misc menu, clik in the drawing window,
and run the program. Then click somewhere else and run the program again.
}
program Oval;
var h,v,majorAxis,minorAxis,x,ang;
procedure initialize;
begin
majorAxis:=50; { major axis of the ellipse }
minorAxis:=10; { minor axis of the ellipse }
ang:=10; { orientation }
x:=1-tan(pi/8)*2;
ang:=ang*pi/180;
end;
procedure l(x,y:real);
begin
line(cos(ang)*x+sin(ang)*y,-sin(ang)*x + cos(ang)*y);
end;
procedure m(x,y:real);
begin
move(cos(ang)*x+sin(ang)*y,-sin(ang)*x + cos(ang)*y);
end;
begin
GetClickedCoord(h,v);
v:=v-minorAxis;
{DrawEllipse(h-2*majorAxis,v,h+2*majorAxis,v+4*minorAxis);}
openpoly(1,1);
moveto(h,v);
m(0,-minorAxis);
l(majorAxis*(1-x),0);
l(majorAxis*(1+x),minorAxis*(1+x));
l(0,2*minorAxis*(1-x));
l(-majorAxis*(1+x),minorAxis*(1+x));
l(-2*majorAxis*(1-x),0);
l(-majorAxis*(1+x),-minorAxis*(1+x));
l(0,-2*minorAxis*(1-x));
l(majorAxis*(1+x),-minorAxis*(1+x));
l(majorAxis*(1-x),0);
closepoly;
end;